package com.bflow.api.bo;

import com.bflow.api.constant.BflowConstant;
import com.bflow.commons.bean.SelectBean;
import com.bflow.commons.util.StrUtil;

import java.util.List;

/**
 * 功能：BflowDefineProcess 流程定义-BO(business object)业务对象
 * 作者：haowen
 * 日期：2018-12-13
 */
public class BflowDefineProcessBo implements SelectBean {

    private static final long serialVersionUID = -622229976534939493L;
	
    /**
     * 流程定义ID
	 */
	private String id;

    /**
     * 流程KEY
	 */
	private String key;

    /**
     * 流程名称
	 */
	private String name;

    /**
     * 流程描述
	 */
	private String desc;

	/**
	 * 类型: def=默认, set=自定义
	 */
	private String type;

    /**
     * 活动集合
	 */
	private String actSet;

	/**
	 * 活动参与者集合
	 */
	private String actAssigneeSet;
	/**
	 * 抄送间隔类型: start=开始、end=结束、endPass=通过结束、endNoPass=不通过结束、ever=永远
	 */
	private String copyToIntervalType;
	/**
	 * 抄送人  格式: _id_,_id_
	 */
	private String copyTo;
	/**
     * 开始活动
	 */
	private String startActId;

    /**
     * 状态：0-不可用；1-可用；
	 */
	private String status;

    /**
     * 创建时间
	 */
	private java.util.Date createTime;

    /**
     * 更新时间
	 */
	private java.util.Date updateTime;

	/** 版本号 */
	private Integer version;

	private List<BflowDefineActRouteBo> routeBos; //路由规则

	/**
	 * 活动名称集合
	 */
	private String actNameSet;

	/**
	 * 流程业务数据
	 */
	private BflowRunInstanceBo instance;

	public BflowDefineProcessBo(){
	}

	public BflowDefineProcessBo( String id ){
		this.id = id;
	}

	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}

	public String getKey() {
		return this.key;
	}
	public void setKey(String key) {
		this.key = key;
	}

	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public String getDesc() {
		return this.desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getType() {
		return this.type;
	}
	public void setType(String type) {
		this.type = type;
	}


	public String getActSet() {
		return this.actSet;
	}
	public void setActSet(String actSet) {
		this.actSet = actSet;
	}
	public String[] getActArray() {
		if(StrUtil.isNotBlank(actSet)){
			return actSet.split(BflowConstant.ACT_SPLIT);
		}
		return null;
	}

	public String getActAssigneeSet() {
		return this.actAssigneeSet;
	}
	public void setActAssigneeSet(String actAssigneeSet) {
		this.actAssigneeSet = actAssigneeSet;
	}

	public String[] getActAssigneeArray() {
		if(StrUtil.isNotBlank(actAssigneeSet)){
			return actAssigneeSet.split(BflowConstant.ACT_SPLIT);
		}
		return null;
	}

	/**
	 * 获取 开始活动节点的 参与者
	 * @return
     */
	public String getStartActAssignee() {
		if(StrUtil.isNotBlank(actAssigneeSet)){
			return actAssigneeSet.split(BflowConstant.ACT_SPLIT)[0];
		}
		return null;
	}

	public String getCopyToIntervalType() {
		return this.copyToIntervalType;
	}
	public void setCopyToIntervalType(String copyToIntervalType) {
		this.copyToIntervalType = copyToIntervalType;
	}

	public String getCopyTo() {
		return this.copyTo;
	}
	public void setCopyTo(String copyTo) {
		this.copyTo = copyTo;
	}

	public String getStartActId() {
		return this.startActId;
	}
	public void setStartActId(String startActId) {
		this.startActId = startActId;
	}

	public String getStatus() {
		return this.status;
	}
	public void setStatus(String status) {
		this.status = status;
	}

	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(java.util.Date createTime) {
		this.createTime = createTime;
	}

	public java.util.Date getUpdateTime() {
		return this.updateTime;
	}
	public void setUpdateTime(java.util.Date updateTime) {
		this.updateTime = updateTime;
	}

	public Integer getVersion() {
		return this.version;
	}
	public void setVersion(Integer version) {
		this.version = version;
	}

	public List<BflowDefineActRouteBo> getRouteBos() {
		return this.routeBos;
	}
	public void setRouteBos(List<BflowDefineActRouteBo> routeBos) {
		this.routeBos = routeBos;
	}

	public String getActNameSet() {
		return this.actNameSet;
	}
	public void setActNameSet(String actNameSet) {
		this.actNameSet = actNameSet;
	}

	@Override
	public String getValue() {
		return getKey();
	}

	@Override
	public String getText() {
		return getName();
	}

	public BflowRunInstanceBo getInstance() {
		return instance;
	}

	public void setInstance(BflowRunInstanceBo instance) {
		this.instance = instance;
	}
}

